import os
import random
import sys
import time
import shutil
import PyQt5.QtCore
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtMultimedia import QMediaPlayer, QMediaContent
from PyQt5.QtWidgets import QMainWindow, QApplication, QAbstractItemView, QFileDialog
from PyQt5.QtCore import QBasicTimer

from connect_database.get_music_file import MusicInformationGetter
from connect_database.music_tools import MusicTool
from connect_database.user_tools import UserTool
from music_recommendation.recommend import CollaborativeFiltering
from ui.main_windows import Ui_MainWindow


def deal_time(x):
    x = str(x)
    if len(x) == 1:
        x = '0' + x
    return x


# 播放时间
def itv2_time(iitv):
    iitv = int(iitv)

    # 求小时整数。
    h = iitv // 3600
    # 求余数。
    h_remainder = iitv % 3600

    # 求分钟整数。
    m = h_remainder // 60
    # 求余数为秒。
    s = h_remainder % 60

    return ":".join(map(deal_time, (m, s)))


class MainWindow(QMainWindow, Ui_MainWindow):
    """
        self.music_info = None #用户音乐信息
        self.mt = None #音乐数据库连接工具
    """
    # 跳转页面信号
    jump_signal = QtCore.pyqtSignal(int)
    music_name_signal = QtCore.pyqtSignal(int)

    def __init__(self, user_name, user_id, pass_word):
        super(MainWindow, self).__init__()
        self.index = None
        self.music_recommends = None
        self.setupUi(self)
        self.tableWidget_1 = None  # 播放记录最外层控件
        self.tableWidget_2 = None  # 搜索框最外层控件
        self.tableWidget = None  # 我的收藏最外层控件
        # self.label_14.hide()  # 猜你喜欢最外层控件
        self.scrollArea = None  # 排行榜最外层控件
        self.widget_14 = None  # 分享音乐最外层
        self.label_19.clear()
        self.label_20.clear()
        # 用户数据库工具
        self.login = None
        self.ut = None
        self.mt = None
        self.cur_playing_song = None  # 当前歌曲播放
        self.music_info = None

        self._translate = QtCore.QCoreApplication.translate
        # 临时存放当前用户
        self.current_user_id = user_id
        self.current_user = user_name
        self.current_password = pass_word
        self.my_introduction = None

        # 推荐工具类
        self.cf = CollaborativeFiltering()
        self.music_recommends = self.cf.CF_recommend(str(self.current_user_id), 50)

        # 播放列表
        self.ut = UserTool()
        self.music_play_list = []

        # 获取用户收藏信息
        self.ut = UserTool()
        self.user_collections = self.ut.get_user_collections(self.current_user)
        if not self.user_collections:
            self.user_collections = []
        print("用户收藏音乐>>>", self.user_collections)

        # 存放搜索结果
        self.search_results_list = []
        # 存放用户推荐音乐模块
        self.music_recommend_info = []

        # 音乐播放控件
        self.player = QMediaPlayer()
        # 时钟
        self.timer = None
        self.play_index = 0

        self.play_time = 0

        # 播放/暂停信号
        self.is_switching = True
        # 绑定播放
        self.pushButton_3.clicked.connect(self.music_play)

        # 排行榜点击绑定
        self.pushButton_7.clicked.connect(self.init_leaderboard)
        # 猜你喜欢点击绑定
        self.pushButton_9.clicked.connect(self.init_you_like)
        # 搜索框点击绑定
        self.pushButton.clicked.connect(self.insert_search)
        # 我的收藏点击绑定
        self.pushButton_8.clicked.connect(self.init_collection)
        # 上一首音乐绑定
        self.pushButton_4.clicked.connect(self.previous_piece)
        # 下一首音乐绑定
        self.pushButton_2.clicked.connect(self.next_song)
        # 用户管理绑定
        self.pushButton_6.clicked.connect(self.init_user_manage)
        # 上传音乐
        self.pushButton_11.clicked.connect(self.init_share_music)
        # 播放记录
        self.pushButton_10.clicked.connect(self.init_play_record)
        # 搜索回车绑定事件
        self.lineEdit.returnPressed.connect(self.insert_search)
        # 给进度条的拖拽移动
        self.horizontalSlider.sliderMoved[int].connect(self.drag_play)
        # 进度条释放时释放是设置大小
        self.horizontalSlider.sliderReleased.connect(self.drag_release)
        # 存储当前页面与上一个页面
        self.jump_signal_list = [2, 2]
        self.is_menu = 0
        self.jump_signal.connect(self.init_menu)
        self.music_leaderboard = None
        # 加载排行榜
        self.load_leaderboard()
        # 初始化收藏信息
        self.init_recommend()

    # 初始化用户推荐模块---推荐用户播放次数
    def init_recommend(self):
        if self.music_recommends:
            for music_id, ratio in self.music_recommends:
                self.mt = MusicTool()
                music_info = self.mt.get_one_music(music_id=music_id)
                self.music_recommend_info.append(music_info)
        else:
            # 没有推荐歌曲，随机生成
            random_music_id = [random.randint(1, 100) for i in range(20)]
            for music_id in random_music_id:
                self.mt = MusicTool()
                music_info = self.mt.get_one_music(music_id=music_id)
                self.music_recommend_info.append(music_info)
        print("推荐模块加载成功", self.music_recommend_info)

    # 修改排行榜的收藏图标
    def user_leaderboard_collect(self, music_name, push):
        push_name = push.objectName()
        if self.user_collections:
            for item in self.user_collections:
                if music_name in item:
                    # 已经收藏
                    push.setStyleSheet("image: url(./images/yes_collect.png);\n"
                                       "border:0;")
                    self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/like.png);\n"
                                                     "border:0;"
                                                     "padding:3px;}")
                    self.pushButton_17.setEnabled(False)
                    push.setEnabled(False)
                    break
            else:
                push.setStyleSheet("#" + push_name + "{image: url(./images/collection.png);\n"
                                                     "border:0;}#" + push_name + ":hover{padding:7px;}")
                self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/no_like.png);\n"
                                                 "border:0;"
                                                 "padding:3px;}"
                                                 "#pushButton_17:hover{padding:5px;}")
        else:
            push.setStyleSheet("#" + push_name + "{image: url(./images/collection.png);\n"
                                                 "border:0;}#" + push_name + ":hover{padding:7px;}")
            self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/no_like.png);\n"
                                             "border:0;"
                                             "padding:3px;}"
                                             "#pushButton_17:hover{padding:5px;}")
        self.pushButton_17.setEnabled(False)
        push.setEnabled(True)

    # 双击播放搜索列表
    def play_search_music(self):
        current_row = self.tableWidget_2.currentRow()
        self.player = QMediaPlayer()
        self.horizontalSlider.setValue(0)
        # 获取路径信息
        music_name, music_path, singer, music_duration = self.search_results_list[current_row - 1]
        if not (self.search_results_list[current_row - 1] in self.music_play_list):
            self.music_play_list.append(self.search_results_list[current_row - 1])
        self.play_index = self.music_play_list.index(self.music_play_list[current_row - 1])  # 获取播放索引
        self.player.setMedia(QMediaContent(QUrl.fromLocalFile(music_path)))
        self.horizontalSlider.setRange(0, music_duration)
        self.horizontalSlider.setValue(0)
        # 歌名
        self.label_20.setText(music_name)
        # 歌手
        self.label_19.setText(singer)
        # 喜欢
        self.pushButton_17.clicked.connect(lambda: self.modify_like_collect(music_name, self.pushButton_17))
        self.modify_like_pictures(music_name, self.pushButton_17)
        self.mt = MusicTool()
        music_id, _, _, _, music_label = self.mt.get_music_info(music_name)
        self.mt = MusicTool()
        self.mt.insert_play_record(self.current_user_id, music_id, self.play_time, music_label)
        self.timer = QBasicTimer()
        self.is_switching = False
        self.timer.start(1000, self)
        self.player.play()
        self.play_time = 0

    # 增加收藏
    def insert_collect(self, music_name, push):
        self.mt = MusicTool()
        music_id, audio_path, singer, music_duration, _ = self.mt.get_music_info(music_name)
        if music_id:
            # 添加用户
            self.ut = UserTool()
            result = self.ut.insert_collections(self.current_user_id, music_id)
            if result:
                print("{}收藏成功, 已更新表格".format(music_name))
                self.user_collections.append([music_name, audio_path, singer, music_duration])
                push.setStyleSheet("image: url(./images/yes_collect.png);\n"
                                   "border:0;")
                self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/like.png);\n"
                                                 "border:0;"
                                                 "padding:3px}")
                self.pushButton_17.setEnabled(False)
                push.setEnabled(False)
            else:
                print("{}已经收藏".format(music_name))

    # 修改猜你喜欢图标
    def modify_like_pictures(self, music_name, push):
        push_name = push.objectName()
        if self.user_collections:
            for item in self.user_collections:
                if music_name in item:
                    # 已经收藏
                    push.setStyleSheet("image: url(./images/like.png);\n"
                                       "border:0;")
                    push.setEnabled(False)
                    break
            else:
                push.setStyleSheet("#" + push_name + "{image: url(./images/no_like.png);\n"
                                                     "border:0;"
                                                     "padding:3px}#" + push_name + ":hover{padding:5px;}")
        else:
            push.setStyleSheet("#" + push_name + "{image: url(./images/no_like.png);\n"
                                                 "border:0;"
                                                 "padding:3px}#" + push_name + ":hover{padding:3px;}")

        push.setEnabled(True)

    # 猜你喜欢收藏
    def modify_like_collect(self, music_name, push):
        self.mt = MusicTool()
        music_id, audio_path, singer, music_duration, _ = self.mt.get_music_info(music_name)
        if music_id:
            # 添加用户
            self.ut = UserTool()
            result = self.ut.insert_collections(self.current_user_id, music_id)
            if result:
                print("{}收藏成功, 已更新表格".format(music_name))
                self.user_collections.append([music_name, audio_path, singer, music_duration])
                push.setStyleSheet("image: url(./images/like.png);\n"
                                   "border:0;")
                push.setEnabled(False)
            else:
                print("{}已经收藏".format(music_name))

    # 加载排行榜
    def load_leaderboard(self):
        self.mt = MusicTool()
        music_count = self.mt.get_ten_play_music()
        if music_count:
            self.music_leaderboard = music_count
            print("排行榜音乐>>> ", self.music_leaderboard)
        else:
            self.music_leaderboard = []
            print("加载排行榜失败")

    # 页面切换
    def init_menu(self, menu_signal):
        """
            控制主页面，功能页面跳转
            self.jump_signal=1:排行榜
            self.jump_signal=2:猜你喜欢
            self.jump_signal=3:我的收藏
            self.jump_signal=4:搜索框
            self.jump_signal=5:用户信息
            self.jump_signal=6:上传音乐
            self.jump_signal=7:播放记录
        """
        # 记录上一个页面
        self.jump_signal_list[0] = self.jump_signal_list[1]
        # 存放当前页面
        self.jump_signal_list[1] = menu_signal
        # 搜索框
        if menu_signal == 4:
            if self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.music_play_list.clear()
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 播放记录
        elif menu_signal == 7:
            self.pushButton_10.setEnabled(False)
            self.widget_6.setStyleSheet("#widget_6{\n"
                                        "border-bottom:2px solid #ffaa00;}"
                                        )
            if self.jump_signal_list[0] == 4 and self.tableWidget_2:
                self.tableWidget_2.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 我的收藏
        elif menu_signal == 3:
            self.pushButton_8.setEnabled(False)
            self.widget_4.setStyleSheet("#widget_4{\n"
                                        "border-bottom:2px solid #ffaa00;}"
                                        )
            if self.jump_signal_list[0] == 4 and self.tableWidget_2:
                self.tableWidget_2.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 排行榜
        elif menu_signal == 1:
            self.pushButton_7.setEnabled(False)
            self.widget_3.setStyleSheet("#widget_3{\n"
                                        "border-bottom:2px solid #ffaa00;}"
                                        )
            if self.jump_signal_list[0] == 4 and self.tableWidget_2:
                self.tableWidget_2.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.music_play_list.clear()
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 猜你喜欢
        elif menu_signal == 2:
            self.pushButton_9.setEnabled(False)
            self.widget_5.setStyleSheet("#widget_5{\n"
                                        "border-bottom:2px solid #ffaa00;}"
                                        )
            if self.jump_signal_list[0] == 4 and self.tableWidget_2:
                self.tableWidget_2.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 分享音乐
        elif menu_signal == 6:
            self.pushButton_11.setEnabled(False)
            self.widget_7.setStyleSheet("#widget_7{\n"
                                         "border-bottom:2px solid #ffaa00;}"
                                         )
            if self.jump_signal_list[0] == 4 and self.tableWidget_2:
                self.tableWidget_2.hide()
                return
            elif self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.music_play_list.clear()
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 5:
                self.widget_12.hide()
                self.pushButton_6.setEnabled(True)
                return

        # 用户管理
        elif menu_signal == 5:
            self.pushButton_6.setEnabled(False)
            if self.jump_signal_list[0] == 4  and self.tableWidget_2:
                self.tableWidget_2.hide()
                return
            elif self.jump_signal_list[0] == 7:
                self.pushButton_10.setEnabled(True)
                self.tableWidget_1.hide()
                self.widget_6.setStyleSheet("#widget_6:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 3:
                self.pushButton_8.setEnabled(True)
                self.tableWidget.hide()
                self.widget_4.setStyleSheet("#widget_4:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 1:
                self.pushButton_7.setEnabled(True)
                self.scrollArea.hide()
                self.widget_3.setStyleSheet("#widget_3:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 2:
                self.music_play_list.clear()
                self.pushButton_9.setEnabled(True)
                self.label_14.hide()
                self.widget_5.setStyleSheet("#widget_5:hover{\n"
                                            "border-bottom:2px solid #ffaa00;}"
                                            )
                return
            elif self.jump_signal_list[0] == 6:
                self.pushButton_11.setEnabled(True)
                self.widget_14.hide()
                self.widget_7.setStyleSheet("#widget_7:hover{\n"
                                             "border-bottom:2px solid #ffaa00;}"
                                             )
                return

    # 初始化搜索显示
    def init_search(self):
        # 固有显示控件--导航标签
        self.tableWidget_2 = QtWidgets.QTableWidget(self.widget_9)
        self.tableWidget_2.setStyleSheet("border:0;")
        self.tableWidget_2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.tableWidget_2.setAutoScroll(True)
        self.tableWidget_2.setAutoScrollMargin(7)
        self.tableWidget_2.setTabKeyNavigation(True)
        self.tableWidget_2.setProperty("showDropIndicator", True)
        self.tableWidget_2.setDragEnabled(False)
        self.tableWidget_2.setDragDropOverwriteMode(True)
        self.tableWidget_2.setAlternatingRowColors(False)
        self.tableWidget_2.setShowGrid(False)
        self.tableWidget_2.setWordWrap(True)
        self.tableWidget_2.setCornerButtonEnabled(False)
        self.tableWidget_2.setObjectName("tableWidget")
        self.tableWidget_2.setColumnCount(6)
        # 设置表的行数， 第一行当成表头
        self.tableWidget_2.setRowCount(len(self.search_results_list) + 1)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.tableWidget_2.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_2.setHorizontalHeaderItem(5, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 1, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setBackground(brush)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 2, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 3, item)
        item = QtWidgets.QTableWidgetItem()
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 4, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)  # 居中
        # 设置字体样式
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_2.setItem(0, 5, item)
        # 表头
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget_2.verticalHeaderItem(1)
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget_2.horizontalHeaderItem(0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget_2.horizontalHeaderItem(1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget_2.horizontalHeaderItem(2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget_2.horizontalHeaderItem(3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget_2.horizontalHeaderItem(5)
        item.setText(self._translate("MainWindow", "删除"))
        __sortingEnabled = self.tableWidget_2.isSortingEnabled()
        self.tableWidget_2.setSortingEnabled(False)
        item = self.tableWidget_2.item(0, 0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget_2.item(0, 1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget_2.item(0, 2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget_2.item(0, 3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget_2.item(0, 5)
        item.setText(self._translate("MainWindow", "收藏"))
        self.tableWidget_2.horizontalHeader().setVisible(False)
        self.tableWidget_2.horizontalHeader().setDefaultSectionSize(119)
        self.tableWidget_2.horizontalHeader().setHighlightSections(True)
        self.tableWidget_2.horizontalHeader().setMinimumSectionSize(31)
        self.tableWidget_2.verticalHeader().setVisible(False)
        self.tableWidget_2.verticalHeader().setDefaultSectionSize(38)
        self.tableWidget_2.verticalHeader().setMinimumSectionSize(30)
        self.tableWidget_2.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableWidget_2.setAlternatingRowColors(True)  # 使表格颜色交错显示
        self.tableWidget_2.setSortingEnabled(__sortingEnabled)
        # 表数据
        for i, music_info in enumerate(self.search_results_list):
            i = i + 1
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            self.tableWidget_2.setItem(i, 0, item)
            item.setText(self._translate("MainWindow", str(i)))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            self.tableWidget_2.setItem(i, 1, item)
            item.setText(self._translate("MainWindow", music_info[0]))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            self.tableWidget_2.setItem(i, 2, item)
            item.setText(self._translate("MainWindow", music_info[2]))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            self.tableWidget_2.setItem(i, 3, item)
            item.setText(self._translate("MainWindow", itv2_time(music_info[3])))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
            self.tableWidget_2.setItem(i, 4, item)
            item.setText(self._translate("MainWindow", ""))
            collectPushButton = QtWidgets.QPushButton()
            self.tableWidget_2.setCellWidget(i, 5, collectPushButton)
            collectPushButton.setObjectName("collectPushButton")
            self.search_collect_picture(music_info[0], collectPushButton)
            collectPushButton.clicked.connect(lambda: self.insert_collect(music_info[0], collectPushButton))
        self.tableWidget_2.itemDoubleClicked.connect(self.play_search_music)
        self.verticalLayout_4.addWidget(self.tableWidget_2)

    # 修改搜索结果图标
    def search_collect_picture(self, music_name, push):
        push_name = push.objectName()
        if self.user_collections:
            for item in self.user_collections:
                if music_name in item:
                    # 已经收藏
                    push.setStyleSheet("image: url(./images/yes_collect.png);\n"
                                       "border:0;"
                                       "padding:3px;")
                    self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/like.png);\n"
                                                     "border:0;"
                                                     "padding:5px;}")
                    self.pushButton_17.setEnabled(False)
                    push.setEnabled(False)
                    break
            else:
                push.setStyleSheet("#" + push_name + "{image: url(./images/collection.png);\n"
                                                     "border:0;padding:3px;}#" + push_name + ":hover{padding:5px;}")
                self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/no_like.png);\n"
                                                 "border:0;"
                                                 "padding:3px;}"
                                                 "#pushButton_17:hover{padding:5px;}")
        else:
            push.setStyleSheet("#" + push_name + "{image: url(./images/collection.png);\n"
                                                 "border:0;padding:3px;}#" + push_name + ":hover{padding:5px;}")
            self.pushButton_17.setStyleSheet("#pushButton_17{image: url(./images/no_like.png);\n"
                                             "border:0;"
                                             "padding:3px;}"
                                             "#pushButton_17:hover{padding:5px;}")
        self.pushButton_17.setEnabled(False)
        push.setEnabled(True)

    # 排行榜播放器设置
    def leaderboard_play_music(self, music_info):
        # 获取音乐信息
        music_name, audio_path, singer, music_duration, _ = music_info
        music_info = [music_name, audio_path, singer, music_duration]
        if not (music_info in self.music_play_list):
            self.music_play_list.append(music_info)
        self.play_index = self.music_play_list.index(music_info)  # 获取播放索引
        self.player = QMediaPlayer()
        self.horizontalSlider.setValue(0)
        self.play_time = 0
        self.player.setMedia(QMediaContent(QUrl.fromLocalFile(audio_path)))
        self.player.setPosition(0)
        self.horizontalSlider.setRange(0, music_duration)
        # 歌名
        self.label_20.setText(music_name)
        # 歌手
        self.label_19.setText(singer)
        # 喜欢
        self.pushButton_17.clicked.connect(lambda: self.modify_like_collect(music_name, self.pushButton_17))
        self.modify_like_pictures(music_name, self.pushButton_17)
        self.mt = MusicTool()
        music_id, _, _, _, music_label = self.mt.get_music_info(music_name)
        self.mt = MusicTool()
        self.mt.insert_play_record(self.current_user_id, music_id, self.play_time, music_label)
        self.timer = QBasicTimer()
        self.is_switching = False
        self.timer.start(1000, self)
        self.player.play()

    # 加载初始推荐音乐---只加载第一首
    def load_first_recommend(self):
        self.player = QMediaPlayer()
        self.horizontalSlider.setValue(0)
        self.timer = QBasicTimer()
        self.play_time = 0
        self.play_index = 0
        self.is_switching = True
        if self.music_play_list:
            self.player.setMedia(QMediaContent(QUrl.fromLocalFile(self.music_play_list[0][1])))
            self.player.setPosition(0)
            self.horizontalSlider.setRange(0, self.music_play_list[0][3])
            # 歌名
            self.label_20.setText(self.music_play_list[0][0])
            # 歌手
            self.label_19.setText(self.music_play_list[0][2])
            self.modify_like_pictures(self.music_play_list[0][0], self.pushButton_17)

    # 初始化我的收藏
    def init_collection(self):
        # 固有显示控件--导航标签
        self.music_play_list = self.user_collections
        self.tableWidget = QtWidgets.QTableWidget(self.widget_9)
        self.tableWidget.setStyleSheet("border:0;")
        self.tableWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.tableWidget.setAutoScroll(True)
        self.tableWidget.setAutoScrollMargin(7)
        self.tableWidget.setTabKeyNavigation(True)
        self.tableWidget.setProperty("showDropIndicator", True)
        self.tableWidget.setDragEnabled(False)
        self.tableWidget.setDragDropOverwriteMode(True)
        self.tableWidget.setAlternatingRowColors(False)
        self.tableWidget.setShowGrid(False)
        self.tableWidget.setWordWrap(True)
        self.tableWidget.setCornerButtonEnabled(False)
        self.tableWidget.setObjectName("tableWidget")
        self.tableWidget.setColumnCount(6)
        # 设置表的行数， 第一行当成表头
        if self.user_collections:
            self.tableWidget.setRowCount(len(self.user_collections) + 1)
        else:
            self.tableWidget.setRowCount(2)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.tableWidget.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget.setHorizontalHeaderItem(5, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 1, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setBackground(brush)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 2, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 3, item)
        item = QtWidgets.QTableWidgetItem()
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 4, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)  # 居中
        # 设置字体样式
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget.setItem(0, 5, item)

        # 表头
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget.verticalHeaderItem(1)
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget.horizontalHeaderItem(0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget.horizontalHeaderItem(1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget.horizontalHeaderItem(2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget.horizontalHeaderItem(3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget.horizontalHeaderItem(5)
        item.setText(self._translate("MainWindow", "删除"))
        __sortingEnabled = self.tableWidget.isSortingEnabled()
        self.tableWidget.setSortingEnabled(False)
        item = self.tableWidget.item(0, 0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget.item(0, 1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget.item(0, 2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget.item(0, 3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget.item(0, 5)
        item.setText(self._translate("MainWindow", "删除"))
        self.tableWidget.horizontalHeader().setVisible(False)
        self.tableWidget.horizontalHeader().setDefaultSectionSize(119)
        self.tableWidget.horizontalHeader().setHighlightSections(True)
        self.tableWidget.horizontalHeader().setMinimumSectionSize(31)
        self.tableWidget.verticalHeader().setVisible(False)
        self.tableWidget.verticalHeader().setDefaultSectionSize(38)
        self.tableWidget.verticalHeader().setMinimumSectionSize(30)
        self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableWidget.setAlternatingRowColors(True)  # 使表格颜色交错显示
        self.tableWidget.setSortingEnabled(__sortingEnabled)
        # 表数据
        if self.user_collections:
            for i, music_info in enumerate(self.user_collections):
                i = i + 1
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(i, 0, item)
                item.setText(self._translate("MainWindow", str(i)))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(i, 1, item)
                item.setText(self._translate("MainWindow", music_info[0]))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(i, 2, item)
                item.setText(self._translate("MainWindow", music_info[2]))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(i, 3, item)
                item.setText(self._translate("MainWindow", itv2_time(music_info[3])))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget.setItem(i, 4, item)
                item.setText(self._translate("MainWindow", ""))
                deletePushButton = QtWidgets.QPushButton()
                self.tableWidget.setCellWidget(i, 5, deletePushButton)
                deletePushButton.setObjectName("deletePushButton")
                deletePushButton.setStyleSheet("#deletePushButton{image: url(./images/delete.png);"
                                               "padding:3px;}"
                                               "#deletePushButton:hover{padding:7px;}")
                deletePushButton.clicked.connect(self.delete_collect)
        else:
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 0, item)
            item.setText(self._translate("MainWindow", "没有歌曲,快去添"))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 1, item)
            item.setText(self._translate("MainWindow", "加吧!!!(=^O^=)"))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 2, item)
            item.setText(self._translate("MainWindow", " "))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 3, item)
            item.setText(self._translate("MainWindow", " "))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 4, item)
            item.setText(self._translate("MainWindow", " "))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget.setItem(1, 5, item)
            item.setText(self._translate("MainWindow", " "))
        self.tableWidget.itemDoubleClicked.connect(self.item_double_clicked_event)
        self.verticalLayout_4.addWidget(self.tableWidget)
        self.jump_signal.emit(3)

    # 删除收藏
    def delete_collect(self):
        # 收藏删除按钮发出信息接收
        button = self.tableWidget.sender()
        if button and self.user_collections:
            # 获取去发出信息的行数
            row = self.tableWidget.indexAt(button.pos()).row()
            self.tableWidget.removeRow(row)  # 移除表格信息
            # 获取音乐id
            index = row - 1  # 用户收藏索引
            self.mt = MusicTool()
            music_id, _, _, _, _ = self.mt.get_music_info(self.user_collections[index][0])
            self.ut = UserTool()
            result = self.ut.delete_user_colletions(self.current_user_id, music_id)
            if not result:
                print("没有删除成功")
                return
            del self.user_collections[index]  # 删除用户收藏信息表
        self.tableWidget.hide()
        self.init_collection()

    # print(f"第{current_row}行0列的值为：{self.tableWidget.item(current_row, 1).text()}")
    # 我的收藏双击播放
    def item_double_clicked_event(self):
        current_row = self.tableWidget.currentRow()
        self.player = QMediaPlayer()
        self.horizontalSlider.setValue(0)
        self.play_time = 0
        if self.user_collections:
            # 获取路径信息
            music_name, music_path, singer, music_duration = self.user_collections[current_row - 1]
            self.player.setMedia(QMediaContent(QUrl.fromLocalFile(music_path)))
            self.horizontalSlider.setRange(0, music_duration)
            self.player.setPosition(0)
            # 歌名
            self.label_20.setText(music_name)
            # 歌手
            self.label_19.setText(singer)
            # 喜欢
            self.modify_like_pictures(music_name, self.pushButton_17)
            self.mt = MusicTool()
            music_id, _, _, _, music_label = self.mt.get_music_info(music_name)
            self.mt = MusicTool()
            self.mt.insert_play_record(self.current_user_id, music_id, self.play_time, music_label)
            self.timer = QBasicTimer()
            self.play_index = current_row - 1
            self.is_switching = False
            self.timer.start(1000, self)
            self.player.play()

    # 歌曲搜索结果初始化
    def insert_search(self):
        if self.tableWidget_2:
            self.tableWidget_2.hide()
        music_name = self.lineEdit.text().strip(" ")
        self.mt = MusicTool()
        self.search_results_list = self.mt.music_search(music_name)
        self.lineEdit.setStyleSheet("border:2px solid #0B4EE7;\n"
                                    "border-radius:5px;")
        # 获取用户输入的文本
        if self.search_results_list:
            # 初始化搜索结果页面
            self.init_search()
        else:
            self.lineEdit.clear()
            self.lineEdit.setStyleSheet("border:2px solid #0B4EE7;\n"
                                        "border-radius:5px;"
                                        "color:red;")
            self.lineEdit.setPlaceholderText("没有该歌曲")
        self.jump_signal.emit(4)

    # 排行榜控件初始化
    def init_leaderboard(self):
        self.scrollArea = QtWidgets.QScrollArea(self.widget_9)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollArea.setStyleSheet("#scrollArea{border:0;}")
        self.scrollArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.scrollArea.setWidgetResizable(True)
        scrollAreaWidgetContents = QtWidgets.QWidget()
        scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 695, 626))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(scrollAreaWidgetContents.sizePolicy().hasHeightForWidth())
        scrollAreaWidgetContents.setSizePolicy(sizePolicy)
        verticalLayout_7 = QtWidgets.QVBoxLayout(scrollAreaWidgetContents)
        verticalLayout_7.setContentsMargins(0, 0, 0, 0)
        verticalLayout_7.setSpacing(9)
        horizontalLayout_21 = QtWidgets.QHBoxLayout()
        label_34 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_21.addWidget(label_34)
        label_39 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_21.addWidget(label_39)
        label_44 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_21.addWidget(label_44)
        spacerItem15 = QtWidgets.QSpacerItem(23, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_21.addItem(spacerItem15)
        label_49 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_21.addWidget(label_49)
        label_133 = QtWidgets.QLabel(scrollAreaWidgetContents)
        label_133.setMinimumSize(QtCore.QSize(0, 0))
        label_133.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        horizontalLayout_21.addWidget(label_133)
        spacerItem16 = QtWidgets.QSpacerItem(12, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_21.addItem(spacerItem16)
        label_50 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_21.addWidget(label_50)
        spacerItem17 = QtWidgets.QSpacerItem(17, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_21.addItem(spacerItem17)
        verticalLayout_7.addLayout(horizontalLayout_21)
        line_2 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_2.setMaximumSize(QtCore.QSize(16777215, 16777215))
        line_2.setFrameShape(QtWidgets.QFrame.HLine)
        line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
        verticalLayout_7.addWidget(line_2)
        horizontalLayout_27 = QtWidgets.QHBoxLayout()
        label_51 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_27.addWidget(label_51)
        label_52 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_27.addWidget(label_52)
        label_53 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_27.addWidget(label_53)
        spacerItem18 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_27.addItem(spacerItem18)
        label_54 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_27.addWidget(label_54)
        spacerItem19 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_27.addItem(spacerItem19)
        pushButton_39 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_39.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_39.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_39.setText("")
        horizontalLayout_27.addWidget(pushButton_39)
        spacerItem20 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_27.addItem(spacerItem20)
        pushButton_19 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_19.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_19.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_19.setText("")
        horizontalLayout_27.addWidget(pushButton_19)
        spacerItem21 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_27.addItem(spacerItem21)
        verticalLayout_7.addLayout(horizontalLayout_27)
        horizontalLayout_60 = QtWidgets.QHBoxLayout()
        line_27 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_27.setMinimumSize(QtCore.QSize(0, 0))
        line_27.setMaximumSize(QtCore.QSize(637, 16777215))
        line_27.setFrameShape(QtWidgets.QFrame.HLine)
        line_27.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_60.addWidget(line_27)
        verticalLayout_7.addLayout(horizontalLayout_60)
        horizontalLayout_29 = QtWidgets.QHBoxLayout()
        label_55 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_29.addWidget(label_55)
        label_56 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_29.addWidget(label_56)
        label_57 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_29.addWidget(label_57)
        spacerItem22 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_29.addItem(spacerItem22)
        label_58 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_29.addWidget(label_58)
        spacerItem23 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_29.addItem(spacerItem23)
        pushButton_40 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_40.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_40.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_40.setText("")
        horizontalLayout_29.addWidget(pushButton_40)
        spacerItem24 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_29.addItem(spacerItem24)
        pushButton_20 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_20.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_20.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_20.setText("")
        horizontalLayout_29.addWidget(pushButton_20)
        spacerItem25 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_29.addItem(spacerItem25)
        verticalLayout_7.addLayout(horizontalLayout_29)
        horizontalLayout_36 = QtWidgets.QHBoxLayout()
        line_13 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_13.setMaximumSize(QtCore.QSize(637, 16777215))
        line_13.setFrameShape(QtWidgets.QFrame.HLine)
        line_13.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_36.addWidget(line_13)
        verticalLayout_7.addLayout(horizontalLayout_36)
        horizontalLayout_30 = QtWidgets.QHBoxLayout()
        label_59 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_30.addWidget(label_59)
        label_60 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_30.addWidget(label_60)
        label_61 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_30.addWidget(label_61)
        spacerItem26 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_30.addItem(spacerItem26)
        label_62 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_30.addWidget(label_62)
        spacerItem27 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_30.addItem(spacerItem27)
        pushButton_41 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_41.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_41.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_41.setText("")
        horizontalLayout_30.addWidget(pushButton_41)
        spacerItem28 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_30.addItem(spacerItem28)
        pushButton_21 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_21.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_21.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_21.setText("")
        horizontalLayout_30.addWidget(pushButton_21)
        spacerItem29 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_30.addItem(spacerItem29)
        verticalLayout_7.addLayout(horizontalLayout_30)
        horizontalLayout_33 = QtWidgets.QHBoxLayout()
        line_12 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_12.setMaximumSize(QtCore.QSize(637, 16777215))
        line_12.setFrameShape(QtWidgets.QFrame.HLine)
        line_12.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_33.addWidget(line_12)
        verticalLayout_7.addLayout(horizontalLayout_33)
        horizontalLayout_34 = QtWidgets.QHBoxLayout()
        label_63 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_34.addWidget(label_63)
        label_64 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_34.addWidget(label_64)
        label_65 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_34.addWidget(label_65)
        spacerItem30 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_34.addItem(spacerItem30)
        label_66 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_34.addWidget(label_66)
        spacerItem31 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_34.addItem(spacerItem31)
        pushButton_42 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_42.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_42.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_42.setText("")
        horizontalLayout_34.addWidget(pushButton_42)
        spacerItem32 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_34.addItem(spacerItem32)
        pushButton_22 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_22.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_22.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_22.setText("")
        horizontalLayout_34.addWidget(pushButton_22)
        spacerItem33 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_34.addItem(spacerItem33)
        verticalLayout_7.addLayout(horizontalLayout_34)
        horizontalLayout_31 = QtWidgets.QHBoxLayout()
        line_10 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_10.setMaximumSize(QtCore.QSize(637, 16777215))
        line_10.setFrameShape(QtWidgets.QFrame.HLine)
        line_10.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_31.addWidget(line_10)
        verticalLayout_7.addLayout(horizontalLayout_31)
        horizontalLayout_35 = QtWidgets.QHBoxLayout()
        label_67 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_35.addWidget(label_67)
        label_68 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_35.addWidget(label_68)
        label_69 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_35.addWidget(label_69)
        spacerItem34 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_35.addItem(spacerItem34)
        label_70 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_35.addWidget(label_70)
        spacerItem35 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_35.addItem(spacerItem35)
        pushButton_43 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_43.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_43.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_43.setText("")
        horizontalLayout_35.addWidget(pushButton_43)
        spacerItem36 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_35.addItem(spacerItem36)
        pushButton_23 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_23.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_23.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_23.setText("")
        horizontalLayout_35.addWidget(pushButton_23)
        spacerItem37 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_35.addItem(spacerItem37)
        verticalLayout_7.addLayout(horizontalLayout_35)
        horizontalLayout_28 = QtWidgets.QHBoxLayout()
        line_9 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_9.setMaximumSize(QtCore.QSize(637, 16777215))
        line_9.setFrameShape(QtWidgets.QFrame.HLine)
        line_9.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_28.addWidget(line_9)
        verticalLayout_7.addLayout(horizontalLayout_28)
        horizontalLayout_37 = QtWidgets.QHBoxLayout()
        label_71 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_37.addWidget(label_71)
        label_72 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_37.addWidget(label_72)
        label_73 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_37.addWidget(label_73)
        spacerItem38 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_37.addItem(spacerItem38)
        label_74 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_37.addWidget(label_74)
        spacerItem39 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_37.addItem(spacerItem39)
        pushButton_44 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_44.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_44.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_44.setText("")
        horizontalLayout_37.addWidget(pushButton_44)
        spacerItem40 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_37.addItem(spacerItem40)
        pushButton_24 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_24.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_24.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_24.setText("")
        horizontalLayout_37.addWidget(pushButton_24)
        spacerItem41 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_37.addItem(spacerItem41)
        verticalLayout_7.addLayout(horizontalLayout_37)
        horizontalLayout_32 = QtWidgets.QHBoxLayout()
        line_11 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_11.setMaximumSize(QtCore.QSize(637, 16777215))
        line_11.setFrameShape(QtWidgets.QFrame.HLine)
        line_11.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_32.addWidget(line_11)
        verticalLayout_7.addLayout(horizontalLayout_32)
        horizontalLayout_42 = QtWidgets.QHBoxLayout()
        label_75 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_42.addWidget(label_75)
        label_76 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_42.addWidget(label_76)
        label_77 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_42.addWidget(label_77)
        spacerItem42 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_42.addItem(spacerItem42)
        label_78 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_42.addWidget(label_78)
        spacerItem43 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_42.addItem(spacerItem43)
        pushButton_45 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_45.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_45.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_45.setText("")
        horizontalLayout_42.addWidget(pushButton_45)
        spacerItem44 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_42.addItem(spacerItem44)
        pushButton_25 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_25.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_25.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_25.setText("")
        horizontalLayout_42.addWidget(pushButton_25)
        spacerItem45 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_42.addItem(spacerItem45)
        verticalLayout_7.addLayout(horizontalLayout_42)
        horizontalLayout_38 = QtWidgets.QHBoxLayout()
        line_14 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_14.setMaximumSize(QtCore.QSize(637, 16777215))
        line_14.setFrameShape(QtWidgets.QFrame.HLine)
        line_14.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_38.addWidget(line_14)
        verticalLayout_7.addLayout(horizontalLayout_38)
        horizontalLayout_43 = QtWidgets.QHBoxLayout()
        label_79 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_43.addWidget(label_79)
        label_80 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_43.addWidget(label_80)
        label_81 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_43.addWidget(label_81)
        spacerItem46 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_43.addItem(spacerItem46)
        label_82 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_43.addWidget(label_82)
        spacerItem47 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_43.addItem(spacerItem47)
        pushButton_46 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_46.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_46.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_46.setText("")
        horizontalLayout_43.addWidget(pushButton_46)
        spacerItem48 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_43.addItem(spacerItem48)
        pushButton_26 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_26.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_26.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_26.setText("")
        horizontalLayout_43.addWidget(pushButton_26)
        spacerItem49 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_43.addItem(spacerItem49)
        verticalLayout_7.addLayout(horizontalLayout_43)
        horizontalLayout_39 = QtWidgets.QHBoxLayout()
        line_15 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_15.setMaximumSize(QtCore.QSize(637, 16777215))
        line_15.setFrameShape(QtWidgets.QFrame.HLine)
        line_15.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_39.addWidget(line_15)
        verticalLayout_7.addLayout(horizontalLayout_39)
        horizontalLayout_45 = QtWidgets.QHBoxLayout()
        label_87 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_45.addWidget(label_87)
        label_88 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_45.addWidget(label_88)
        label_89 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_45.addWidget(label_89)
        spacerItem50 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_45.addItem(spacerItem50)
        label_90 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_45.addWidget(label_90)
        spacerItem51 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_45.addItem(spacerItem51)
        pushButton_48 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_48.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_48.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_48.setText("")
        horizontalLayout_45.addWidget(pushButton_48)
        spacerItem52 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_45.addItem(spacerItem52)
        pushButton_28 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_28.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_28.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_28.setText("")
        horizontalLayout_45.addWidget(pushButton_28)
        spacerItem53 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_45.addItem(spacerItem53)
        verticalLayout_7.addLayout(horizontalLayout_45)
        horizontalLayout_40 = QtWidgets.QHBoxLayout()
        line_16 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_16.setMaximumSize(QtCore.QSize(637, 16777215))
        line_16.setFrameShape(QtWidgets.QFrame.HLine)
        line_16.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_40.addWidget(line_16)
        verticalLayout_7.addLayout(horizontalLayout_40)
        horizontalLayout_46 = QtWidgets.QHBoxLayout()
        label_91 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_46.addWidget(label_91)
        label_92 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_46.addWidget(label_92)
        label_93 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_46.addWidget(label_93)
        spacerItem54 = QtWidgets.QSpacerItem(26, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_46.addItem(spacerItem54)
        label_94 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_46.addWidget(label_94)
        spacerItem55 = QtWidgets.QSpacerItem(63, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_46.addItem(spacerItem55)
        pushButton_49 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_49.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_49.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_49.setText("")
        horizontalLayout_46.addWidget(pushButton_49)
        spacerItem56 = QtWidgets.QSpacerItem(43, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_46.addItem(spacerItem56)
        pushButton_29 = QtWidgets.QPushButton(scrollAreaWidgetContents)
        pushButton_29.setMinimumSize(QtCore.QSize(0, 31))
        pushButton_29.setMaximumSize(QtCore.QSize(35, 16777215))
        pushButton_29.setText("")
        horizontalLayout_46.addWidget(pushButton_29)
        spacerItem57 = QtWidgets.QSpacerItem(48, 20, QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_46.addItem(spacerItem57)
        verticalLayout_7.addLayout(horizontalLayout_46)
        horizontalLayout_41 = QtWidgets.QHBoxLayout()
        line_17 = QtWidgets.QFrame(scrollAreaWidgetContents)
        line_17.setMaximumSize(QtCore.QSize(637, 16777215))
        line_17.setFrameShape(QtWidgets.QFrame.HLine)
        line_17.setFrameShadow(QtWidgets.QFrame.Sunken)
        horizontalLayout_41.addWidget(line_17)
        verticalLayout_7.addLayout(horizontalLayout_41)
        horizontalLayout_61 = QtWidgets.QHBoxLayout()
        label_134 = QtWidgets.QLabel(scrollAreaWidgetContents)
        horizontalLayout_61.addWidget(label_134)
        verticalLayout_7.addLayout(horizontalLayout_61)
        self.scrollArea.setWidget(scrollAreaWidgetContents)
        self.verticalLayout_4.addWidget(self.scrollArea)
        # 头标题
        label_34.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600; color:#707070;\">排行</span></p></body></html>"))
        label_39.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600; color:#707070;\">歌名</span></p></body></html>"))
        label_44.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600; color:#707070;\">歌手</span></p></body></html>"))
        label_49.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600; color:#ff0000;\">热度</span></p></body></html>"))
        label_133.setText(self._translate("MainWindow",
                                          "<html><head/><body><p align=\"right\"><span style=\" font-size:10pt; font-weight:600; color:#707070;\">播放</span></p></body></html>"))
        label_50.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt; font-weight:600; color:#707070;\">收藏</span></p></body></html>"))

        # 显示数据 第一
        label_51.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">1</p></body></html>"))
        label_52.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[0][0])))
        label_53.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[0][2])))
        label_54.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[0][4])))
        pushButton_19.setObjectName("pushButton_19")
        pushButton_39.setObjectName("pushButton_39")
        pushButton_39.setStyleSheet("#pushButton_39{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_39:hover{padding:3px;}")
        pushButton_39.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[0]))
        self.user_leaderboard_collect(self.music_leaderboard[0][0], pushButton_19)
        pushButton_19.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[0][0], pushButton_19))

        # 第二名
        label_55.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">2</p></body></html>"))
        label_56.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[1][0])))
        label_57.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[1][2])))
        label_58.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[1][4])))
        pushButton_40.setObjectName("pushButton_40")
        pushButton_40.setStyleSheet("#pushButton_40{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_40:hover{padding:3px;}")
        pushButton_40.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[1]))
        pushButton_20.setObjectName("pushButton_20")
        self.user_leaderboard_collect(self.music_leaderboard[1][0], pushButton_20)
        pushButton_20.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[1][0], pushButton_20))

        # 第三名
        label_59.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">3</p></body></html>"))
        label_60.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[2][0])))
        label_61.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[2][2])))
        label_62.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[2][4])))
        pushButton_41.setObjectName("pushButton_41")
        pushButton_41.setStyleSheet("#pushButton_41{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_41:hover{padding:3px;}")
        pushButton_41.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[2]))
        pushButton_21.setObjectName("pushButton_21")
        self.user_leaderboard_collect(self.music_leaderboard[2][0], pushButton_21)
        pushButton_21.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[2][0], pushButton_21))

        # 第四名
        label_63.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">4</p></body></html>"))
        label_64.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[3][0])))
        label_65.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[3][2])))
        label_66.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[3][4])))
        pushButton_42.setObjectName("pushButton_42")
        pushButton_42.setStyleSheet("#pushButton_42{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_42:hover{padding:3px;}")
        pushButton_42.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[3]))
        pushButton_22.setObjectName("pushButton_22")
        self.user_leaderboard_collect(self.music_leaderboard[3][0], pushButton_22)
        pushButton_22.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[3][0], pushButton_22))

        # 第五名
        label_67.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">5</p></body></html>"))
        label_68.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[4][0])))
        label_69.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[4][2])))
        label_70.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[4][4])))
        pushButton_43.setObjectName("pushButton_43")
        pushButton_43.setStyleSheet("#pushButton_43{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_43:hover{padding:3px;}")
        pushButton_43.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[4]))
        pushButton_23.setObjectName("pushButton_23")
        self.user_leaderboard_collect(self.music_leaderboard[4][0], pushButton_23)
        pushButton_23.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[4][0], pushButton_23))

        # 第六名
        label_71.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">6</p></body></html>"))
        label_72.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[5][0])))
        label_73.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[5][2])))
        label_74.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[5][4])))
        pushButton_44.setObjectName("pushButton_44")
        pushButton_44.setStyleSheet("#pushButton_44{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_44:hover{padding:3px;}")
        pushButton_44.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[5]))
        pushButton_24.setObjectName("pushButton_24")
        self.user_leaderboard_collect(self.music_leaderboard[5][0], pushButton_24)
        pushButton_24.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[5][0], pushButton_24))

        # 第七名
        label_75.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">7</p></body></html>"))
        label_76.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[6][0])))
        label_77.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[6][2])))
        label_78.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[6][4])))
        pushButton_45.setObjectName("pushButton_45")
        pushButton_45.setStyleSheet("#pushButton_45{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_45:hover{padding:3px;}")
        pushButton_45.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[6]))
        pushButton_25.setObjectName("pushButton_25")
        self.user_leaderboard_collect(self.music_leaderboard[6][0], pushButton_25)
        pushButton_25.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[6][0], pushButton_25))

        # 第八名
        label_79.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">8</p></body></html>"))
        label_80.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[7][0])))
        label_81.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[7][2])))
        label_82.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[7][4])))
        pushButton_46.setObjectName("pushButton_46")
        pushButton_46.setStyleSheet("#pushButton_46{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_46:hover{padding:3px;}")
        pushButton_46.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[7]))
        pushButton_26.setObjectName("pushButton_26")
        self.user_leaderboard_collect(self.music_leaderboard[7][0], pushButton_26)
        pushButton_26.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[7][0], pushButton_26))

        # 第九名
        label_87.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">9</p></body></html>"))
        label_88.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[8][0])))
        label_89.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[8][2])))
        label_90.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[8][4])))
        pushButton_48.setObjectName("pushButton_48")
        pushButton_48.setStyleSheet("#pushButton_48{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_48:hover{padding:3px;}")
        pushButton_48.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[8]))
        pushButton_28.setObjectName("pushButton_28")
        self.user_leaderboard_collect(self.music_leaderboard[8][0], pushButton_28)
        pushButton_28.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[8][0], pushButton_28))

        # 第十名
        label_91.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">10</p></body></html>"))
        label_92.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[9][0])))
        label_93.setText(
            self._translate("MainWindow", "<html><head/><body><p align=\"center\">{}</p></body></html>".format(
                self.music_leaderboard[9][2])))
        label_94.setText(self._translate("MainWindow",
                                         "<html><head/><body><p align=\"center\"><span style=\" color:#ff0000;\">{}</span></p></body></html>".format(
                                             self.music_leaderboard[9][4])))
        pushButton_49.setObjectName("pushButton_49")
        pushButton_49.setStyleSheet("#pushButton_49{image: url(./images/transmit.png);\n"
                                    "border:0;}"
                                    "#pushButton_49:hover{padding:3px;}")
        pushButton_49.clicked.connect(lambda: self.leaderboard_play_music(self.music_leaderboard[9]))
        pushButton_29.setObjectName("pushButton_29")
        self.user_leaderboard_collect(self.music_leaderboard[9][0], pushButton_29)
        pushButton_29.clicked.connect(lambda: self.insert_collect(self.music_leaderboard[9][0], pushButton_29))
        # 最下面提示
        label_134.setText(self._translate("MainWindow",
                                          "<html><head/><body><p align=\"center\"><span style=\" color:#9f9f9f;font-size:13px;\">我也是有底线的(ꐦÒ‸Ó)</span></p></body></html>"))
        self.jump_signal.emit(1)

    # 分享音乐初始化
    def init_share_music(self):
        self.widget_14 = QtWidgets.QWidget(self.widget_9)
        verticalLayout_6 = QtWidgets.QVBoxLayout(self.widget_14)
        verticalLayout_6.setContentsMargins(0, 0, 0, 0)
        widget_13 = QtWidgets.QWidget(self.widget_14)
        formLayout = QtWidgets.QFormLayout(widget_13)
        formLayout.setFieldGrowthPolicy(QtWidgets.QFormLayout.ExpandingFieldsGrow)
        formLayout.setLabelAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignTrailing | QtCore.Qt.AlignVCenter)
        formLayout.setFormAlignment(QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop)
        formLayout.setContentsMargins(89, 19, 110, 0)
        formLayout.setHorizontalSpacing(13)
        formLayout.setVerticalSpacing(25)
        label = QtWidgets.QLabel(widget_13)
        formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, label)
        lineEdit_2 = QtWidgets.QLabel(widget_13)
        lineEdit_2.setMinimumSize(QtCore.QSize(461, 34))
        lineEdit_2.setStyleSheet("#lineEdit_2{\n"
                                 "border:1px solid #0B4EE7;\n"
                                 "border-radius:5px;\n"
                                 "}\n"
                                 "#lineEdit_2:hover{\n"
                                 "border-color: #F5DE23;\n"
                                 "}")
        lineEdit_2.setObjectName("lineEdit_2")
        formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, lineEdit_2)
        label_2 = QtWidgets.QLabel(widget_13)
        formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, label_2)
        lineEdit_3 = QtWidgets.QLineEdit(widget_13)
        lineEdit_3.setMinimumSize(QtCore.QSize(0, 34))
        lineEdit_3.setStyleSheet("#lineEdit_3{\n"
                                 "border:1px solid #0B4EE7;\n"
                                 "border-radius:5px;\n"
                                 "}\n"
                                 "#lineEdit_3:focus{\n"
                                 "border-color: #F5DE23;\n"
                                 "}")
        lineEdit_3.setObjectName("lineEdit_3")
        formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, lineEdit_3)
        label_5 = QtWidgets.QLabel(widget_13)
        formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, label_5)
        lineEdit_4 = QtWidgets.QLineEdit(widget_13)
        lineEdit_4.setMinimumSize(QtCore.QSize(0, 34))
        lineEdit_4.setStyleSheet("#lineEdit_4{\n"
                                 "border:1px solid #0B4EE7;\n"
                                 "border-radius:5px;\n"
                                 "}\n"
                                 "#lineEdit_4:focus{\n"
                                 "border-color: #F5DE23;\n"
                                 "}")
        lineEdit_4.setObjectName("lineEdit_4")
        formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, lineEdit_4)
        label_7 = QtWidgets.QLabel(widget_13)
        formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, label_7)
        lineEdit_5 = QtWidgets.QLabel(widget_13)
        lineEdit_5.setMinimumSize(QtCore.QSize(461, 34))
        lineEdit_5.setStyleSheet("#lineEdit_5{\n"
                                 "border:1px solid #0B4EE7;\n"
                                 "border-radius:5px;\n"
                                 "}\n"
                                 "#lineEdit_5:hover{\n"
                                 "border-color: #F5DE23;\n"
                                 "}")
        lineEdit_5.setObjectName("lineEdit_5")
        formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, lineEdit_5)
        label_8 = QtWidgets.QLabel(widget_13)
        formLayout.setWidget(4, QtWidgets.QFormLayout.LabelRole, label_8)
        lineEdit_6 = QtWidgets.QLineEdit(widget_13)
        lineEdit_6.setMinimumSize(QtCore.QSize(0, 34))
        lineEdit_6.setStyleSheet("#lineEdit_6{\n"
                                 "border:1px solid #0B4EE7;\n"
                                 "border-radius:5px;\n"
                                 "}\n"
                                 "#lineEdit_6:focus{\n"
                                 "border-color: #F5DE23;\n"
                                 "}")
        lineEdit_6.setObjectName("lineEdit_6")
        formLayout.setWidget(4, QtWidgets.QFormLayout.FieldRole, lineEdit_6)
        verticalLayout_6.addWidget(widget_13)
        horizontalLayout_11 = QtWidgets.QHBoxLayout()
        spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_11.addItem(spacerItem15)
        pushButton_13 = QtWidgets.QPushButton(self.widget_14)
        pushButton_13.setMinimumSize(QtCore.QSize(0, 48))
        pushButton_13.setStyleSheet("#pushButton_13{background-color: #0B4EE7;\n"
                                    "border-radius:10px;\n"
                                    "font-size:15px;\n"
                                    "color: rgb(255, 255, 255);}\n"
                                    "#pushButton_13:hover{\n"
                                    "background-color: #F5DE23;\n"
                                    "color: #0B4EE7;\n"
                                    "}")
        pushButton_13.setObjectName("pushButton_13")
        horizontalLayout_11.addWidget(pushButton_13)
        spacerItem16 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_11.addItem(spacerItem16)
        pushButton_12 = QtWidgets.QPushButton(self.widget_14)
        pushButton_12.setMinimumSize(QtCore.QSize(0, 48))
        pushButton_12.setStyleSheet("#pushButton_12{background-color: #0B4EE7;\n"
                                    "border-radius:10px;\n"
                                    "font-size:15px;\n"
                                    "color: rgb(255, 255, 255);}\n"
                                    "#pushButton_12:hover{\n"
                                    "background-color: #F5DE23;\n"
                                    "color: #0B4EE7;\n"
                                    "}")
        pushButton_12.setObjectName("pushButton_12")
        horizontalLayout_11.addWidget(pushButton_12)
        spacerItem17 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_11.addItem(spacerItem17)
        horizontalLayout_11.setStretch(0, 1)
        horizontalLayout_11.setStretch(1, 2)
        horizontalLayout_11.setStretch(2, 1)
        horizontalLayout_11.setStretch(3, 2)
        horizontalLayout_11.setStretch(4, 1)
        horizontalLayout_11.setContentsMargins(0, 0, 0, 22)
        verticalLayout_6.addLayout(horizontalLayout_11)
        verticalLayout_6.setStretch(0, 3)
        verticalLayout_6.setStretch(1, 1)
        self.verticalLayout_4.addWidget(self.widget_14)
        label.setText(self._translate("MainWindow",
                                      "<html><head/><body><p><span style=\" font-size:10pt;\">路径:</span></p></body></html>"))
        label_2.setText(self._translate("MainWindow",
                                        "<html><head/><body><p><span style=\" font-size:10pt;\">歌名:</span></p></body></html>"))
        label_5.setText(self._translate("MainWindow",
                                        "<html><head/><body><p><span style=\" font-size:10pt;\">歌手:</span></p></body></html>"))
        label_7.setText(self._translate("MainWindow",
                                        "<html><head/><body><p><span style=\" font-size:10pt;\">时长:</span></p></body></html>"))
        label_8.setText(self._translate("MainWindow",
                                        "<html><head/><body><p><span style=\" font-size:10pt;\">类型:</span></p></body></html>"))
        pushButton_13.setText(self._translate("MainWindow", "选择文件"))
        pushButton_12.setText(self._translate("MainWindow", "上  传"))
        pushButton_13.clicked.connect(
            lambda: self.open_audio_file(lineEdit_2, lineEdit_3, lineEdit_4, lineEdit_5, lineEdit_6))
        pushButton_12.clicked.connect(
            lambda: self.upload_music(lineEdit_2, lineEdit_3, lineEdit_4, lineEdit_5, lineEdit_6))
        self.jump_signal.emit(6)

    # 用户管理页面初始化
    def init_user_manage(self):
        self.widget_12 = QtWidgets.QWidget(self.widget_9)
        self.widget_12.setStyleSheet("#widget_12{border:0;}")
        self.widget_12.setObjectName("widget_12")
        formLayout = QtWidgets.QFormLayout(self.widget_12)
        formLayout.setContentsMargins(18, 18, 68, 10)
        formLayout.setHorizontalSpacing(22)
        formLayout.setVerticalSpacing(20)
        label = QtWidgets.QLabel(self.widget_12)
        formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, label)
        spacerItem15 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        formLayout.setItem(0, QtWidgets.QFormLayout.FieldRole, spacerItem15)
        label_2 = QtWidgets.QLabel(self.widget_12)
        formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, label_2)
        label_7 = QtWidgets.QLabel(self.widget_12)
        label_7.setMinimumSize(QtCore.QSize(0, 30))
        formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, label_7)
        lineEdit_2 = QtWidgets.QLineEdit(self.widget_12)
        lineEdit_2.setMinimumSize(QtCore.QSize(0, 37))
        lineEdit_2.setMaximumSize(QtCore.QSize(16777215, 16777215))
        lineEdit_2.setStyleSheet("border:1px solid #0B4EE7;\n"
                                 "border-radius:6px;")
        formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, lineEdit_2)
        label_8 = QtWidgets.QLabel(self.widget_12)
        formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, label_8)
        textEdit = QtWidgets.QTextEdit(self.widget_12)
        textEdit.setStyleSheet("border:1px solid #0B4EE7;\n"
                               "border-radius:6px;\n"
                               "font-size:17px;")
        formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, textEdit)
        spacerItem16 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        formLayout.setItem(4, QtWidgets.QFormLayout.LabelRole, spacerItem16)
        horizontalLayout_11 = QtWidgets.QHBoxLayout()
        spacerItem17 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_11.addItem(spacerItem17)
        pushButton_12 = QtWidgets.QPushButton(self.widget_12)
        pushButton_12.setMinimumSize(QtCore.QSize(0, 38))
        pushButton_12.setStyleSheet("border:0;\n"
                                    "border-radius:10px;\n"
                                    "background-color:#0B4EE7;\n"
                                    "color:#ffffff;")
        horizontalLayout_11.addWidget(pushButton_12)
        spacerItem18 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
        horizontalLayout_11.addItem(spacerItem18)
        horizontalLayout_11.setStretch(0, 2)
        horizontalLayout_11.setStretch(1, 2)
        horizontalLayout_11.setStretch(2, 3)
        formLayout.setLayout(4, QtWidgets.QFormLayout.FieldRole, horizontalLayout_11)
        lineEdit_3 = QtWidgets.QLineEdit(self.widget_12)
        lineEdit_3.setMinimumSize(QtCore.QSize(0, 37))
        lineEdit_3.setMaximumSize(QtCore.QSize(16777215, 16777215))
        lineEdit_3.setStyleSheet("border:1px solid #0B4EE7;\n"
                                 "border-radius:6px;")
        formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, lineEdit_3)
        self.verticalLayout_4.addWidget(self.widget_12)
        label.setText(self._translate("MainWindow",
                                      "<html><head/><body><p><span style=\" font-size:12pt; font-weight:600; color:#0b4ee7;\">用户信息</span></p></body></html>"))
        label_2.setText(self._translate("MainWindow",
                                        "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt;\">&nbsp;用户名:</span></p></body></html>"))
        label_7.setText(self._translate("MainWindow",
                                        "<html><head/><body><p align=\"center\"><span style=\" font-size:10pt;\">&nbsp;密&nbsp;码:</span></p></body></html>"))
        label_8.setText(self._translate("MainWindow", "<html><head/><body><p>&nbsp;每日分享:</p></body></html>"))
        if self.my_introduction:
            textEdit.setPlainText(self.my_introduction)
        else:
            textEdit.setPlaceholderText(self._translate("MainWindow", "分享你的想法吧φ(゜▽゜*)♪!!!"))
        pushButton_12.setText(self._translate("MainWindow", "保  存"))
        lineEdit_2.setPlaceholderText(self._translate("MainWindow", "{}".format(self.current_password)))
        lineEdit_3.setPlaceholderText(self._translate("MainWindow", "{}".format(self.current_user)))
        pushButton_12.clicked.connect(lambda: self.get_input_user_info(lineEdit_2, lineEdit_3, textEdit))
        self.jump_signal.emit(5)

    # 播放记录初始化
    def init_play_record(self):
        # 播放记录
        self.user_record_list = self.ut.get_one_user_record(self.current_user_id)
        if not self.user_record_list:
            self.user_record_list = []
        print("用户播放音乐>>>", self.user_record_list)
        # 固有显示控件--导航标签
        self.music_play_list = self.user_record_list
        self.tableWidget_1 = QtWidgets.QTableWidget(self.widget_9)
        self.tableWidget_1.setStyleSheet("border:0;")
        self.tableWidget_1.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.tableWidget_1.setAutoScroll(True)
        self.tableWidget_1.setAutoScrollMargin(7)
        self.tableWidget_1.setTabKeyNavigation(True)
        self.tableWidget_1.setProperty("showDropIndicator", True)
        self.tableWidget_1.setDragEnabled(False)
        self.tableWidget_1.setDragDropOverwriteMode(True)
        self.tableWidget_1.setAlternatingRowColors(False)
        self.tableWidget_1.setShowGrid(False)
        self.tableWidget_1.setWordWrap(True)
        self.tableWidget_1.setCornerButtonEnabled(False)
        self.tableWidget_1.setObjectName("tableWidget")
        self.tableWidget_1.setColumnCount(6)
        # 设置表的行数， 第一行当成表头
        if self.music_play_list:
            self.tableWidget_1.setRowCount(len(self.music_play_list) + 1)
        else:
            self.tableWidget_1.setRowCount(2)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        self.tableWidget_1.setVerticalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setVerticalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(0, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(1, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(2, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(3, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(4, item)
        item = QtWidgets.QTableWidgetItem()
        self.tableWidget_1.setHorizontalHeaderItem(5, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 0, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 1, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.NoBrush)
        item.setBackground(brush)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 2, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 3, item)
        item = QtWidgets.QTableWidgetItem()
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 4, item)
        item = QtWidgets.QTableWidgetItem()
        item.setTextAlignment(QtCore.Qt.AlignCenter)  # 居中
        # 设置字体样式
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        item.setFont(font)
        item.setFlags(
            QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsDropEnabled | QtCore.Qt.ItemIsUserCheckable)
        self.tableWidget_1.setItem(0, 5, item)
        # 表头
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget_1.verticalHeaderItem(1)
        item.setText(self._translate("MainWindow", "新建行"))
        item = self.tableWidget_1.horizontalHeaderItem(0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget_1.horizontalHeaderItem(1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget_1.horizontalHeaderItem(2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget_1.horizontalHeaderItem(3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget_1.horizontalHeaderItem(5)
        item.setText(self._translate("MainWindow", "删除"))
        __sortingEnabled = self.tableWidget_1.isSortingEnabled()
        self.tableWidget_1.setSortingEnabled(False)
        item = self.tableWidget_1.item(0, 0)
        item.setText(self._translate("MainWindow", "序号"))
        item = self.tableWidget_1.item(0, 1)
        item.setText(self._translate("MainWindow", "歌名"))
        item = self.tableWidget_1.item(0, 2)
        item.setText(self._translate("MainWindow", "歌手"))
        item = self.tableWidget_1.item(0, 3)
        item.setText(self._translate("MainWindow", "时长"))
        item = self.tableWidget_1.item(0, 5)
        item.setText(self._translate("MainWindow", "删除"))
        self.tableWidget_1.horizontalHeader().setVisible(False)
        self.tableWidget_1.horizontalHeader().setDefaultSectionSize(119)
        self.tableWidget_1.horizontalHeader().setHighlightSections(True)
        self.tableWidget_1.horizontalHeader().setMinimumSectionSize(31)
        self.tableWidget_1.verticalHeader().setVisible(False)
        self.tableWidget_1.verticalHeader().setDefaultSectionSize(38)
        self.tableWidget_1.verticalHeader().setMinimumSectionSize(30)
        self.tableWidget_1.setSelectionBehavior(QAbstractItemView.SelectRows)
        self.tableWidget_1.setAlternatingRowColors(True)  # 使表格颜色交错显示
        self.tableWidget_1.setSortingEnabled(__sortingEnabled)
        # 表数据
        if self.music_play_list:
            for i, music_info in enumerate(self.music_play_list):
                i = i + 1
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget_1.setItem(i, 0, item)
                item.setText(self._translate("MainWindow", str(i)))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget_1.setItem(i, 1, item)
                item.setText(self._translate("MainWindow", music_info[0]))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget_1.setItem(i, 2, item)
                item.setText(self._translate("MainWindow", music_info[2]))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget_1.setItem(i, 3, item)
                item.setText(self._translate("MainWindow", itv2_time(music_info[3])))
                item = QtWidgets.QTableWidgetItem()
                item.setTextAlignment(QtCore.Qt.AlignCenter)
                item.setFlags(
                    QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
                self.tableWidget_1.setItem(i, 4, item)
                item.setText(self._translate("MainWindow", ""))
                deletePushButton = QtWidgets.QPushButton()
                self.tableWidget_1.setCellWidget(i, 5, deletePushButton)
                deletePushButton.setObjectName("deletePushButton")
                deletePushButton.setStyleSheet("#deletePushButton{image: url(./images/delete.png);"
                                               "padding:3px;}"
                                               "#deletePushButton:hover{padding:7px;}")
                deletePushButton.clicked.connect(self.delete_recorde)
        else:
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 0, item)
            item.setText(self._translate("MainWindow", "你还没听过歌"))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 1, item)
            item.setText(self._translate("MainWindow", "快去添加吧!!!"))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 2, item)
            item.setText(self._translate("MainWindow", "(=^O^=)"))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 3, item)
            item.setText(self._translate("MainWindow", " "))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 4, item)
            item.setText(self._translate("MainWindow", " "))
            item = QtWidgets.QTableWidgetItem()
            item.setTextAlignment(QtCore.Qt.AlignCenter)
            item.setFlags(
                QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable)
            self.tableWidget_1.setItem(1, 5, item)
            item.setText(self._translate("MainWindow", " "))
        self.tableWidget_1.itemDoubleClicked.connect(self.play_record_music)
        self.verticalLayout_4.addWidget(self.tableWidget_1)
        self.jump_signal.emit(7)

    # 删除用户播放记录
    def delete_recorde(self):
        # 收藏删除按钮发出信息接收
        button = self.tableWidget_1.sender()
        if button and self.music_play_list:
            # 获取去发出信息的行数
            row = self.tableWidget_1.indexAt(button.pos()).row()
            music_name = self.tableWidget_1.item(row, 1).text()
            self.tableWidget_1.removeRow(row)  # 移除表格信息
            # 获取音乐id
            index = row - 1  # 用户收藏索引
            self.ut = UserTool()
            self.ut.delete_user_play_record(self.current_user_id, music_name)
            del self.music_play_list[index]  # 删除用户收藏信息表
        self.tableWidget_1.hide()
        self.init_play_record()

    # 双击播放用户记录
    def play_record_music(self):
        current_row = self.tableWidget_1.currentRow()
        self.player = QMediaPlayer()
        self.horizontalSlider.setValue(0)
        if self.music_play_list:
            # 获取路径信息
            music_name, music_path, singer, music_duration = self.music_play_list[current_row - 1]
            self.player.setMedia(QMediaContent(QUrl.fromLocalFile(music_path)))
            self.horizontalSlider.setRange(0, music_duration)
            self.player.setPosition(0)
            # 歌名
            self.label_20.setText(music_name)
            # 歌手
            self.label_19.setText(singer)
            # 喜欢
            self.pushButton_17.clicked.connect(lambda: self.modify_like_collect(music_name, self.pushButton_17))
            self.modify_like_pictures(music_name, self.pushButton_17)
            self.mt = MusicTool()
            music_id, _, _, _, music_label = self.mt.get_music_info(music_name)
            self.mt = MusicTool()
            self.mt.insert_play_record(self.current_user_id, music_id, self.play_time, music_label)
            self.timer = QBasicTimer()
            self.is_switching = False
            self.play_index = current_row - 1
            self.timer.start(1000, self)
            self.player.play()
        self.play_time = 0

    # 获取用户信息
    def get_input_user_info(self, lineEdit_2, lineEdit_3, textEdit):
        pass_word = lineEdit_2.text().strip(" ")
        user_name = lineEdit_3.text().strip(" ")
        self.my_introduction = textEdit.toPlainText().strip(" ")
        if user_name and pass_word:
            self.ut = UserTool()
            if 0 <= len(pass_word.strip(" ")) <= 8:
                result = self.ut.update_user_information(self.current_user_id, user_name, pass_word)
                if result:
                    self.current_user = user_name
                    self.current_password = pass_word
            else:
                lineEdit_3.setPlaceholderText(self._translate("MainWindow", "密码不要超过8个,不然记不住哦(⊙o⊙)？"))
        self.widget_12.hide()
        self.init_user_manage()

    # 猜你喜欢控件初始化
    def init_you_like(self):
        self.label_14.show()
        self.label_14.setStyleSheet("image: url(./images/play_background.jpg);")
        self.music_play_list = self.music_recommend_info
        self.load_first_recommend()
        if self.music_play_list:
            self.pushButton_17.clicked.connect(
                lambda: self.modify_like_collect(self.music_play_list[self.play_index][0], self.pushButton_17))
            self.modify_like_pictures(self.music_play_list[self.play_index][0], self.pushButton_17)
        self.jump_signal.emit(2)

    # 打开音频文件
    def open_audio_file(self, lineEdit_2, lineEdit_3, lineEdit_4, lineEdit_5, lineEdit_6):
        file_path, file_type = QFileDialog.getOpenFileName(self, "选取音频文件", "./",
                                                           "MP3 Files (*.mp3);;WAV Files (*.wav)")
        try:
            if file_path:
                mig = MusicInformationGetter(file_path)  # 初始化文件音频
                music_name, singer, music_name, music_label, duration = mig.get_music_info()
                if music_name:
                    lineEdit_2.setText(" " + file_path)
                    lineEdit_3.setText(" " + music_name)
                    lineEdit_4.setText(" " + singer)
                    lineEdit_5.setText(" " + itv2_time(duration))
                    lineEdit_6.setText(" " + music_label)
        except Exception as e:
            print(e)

    # 上传音乐
    def upload_music(self, lineEdit_2, lineEdit_3, lineEdit_4, lineEdit_5, lineEdit_6):
        music_name = lineEdit_3.text().strip(" ")
        if (music_name != "未知专辑名") or (not music_name):
            file_path = lineEdit_2.text().strip(" ")
            file_name, file_format = os.path.splitext(file_path)
            duration = lineEdit_5.text().strip(" ")
            duration = duration.split(":")
            music_duration = int(duration[0]) * 60 + int(duration[1])
            singer = lineEdit_4.text().strip(" ")
            music_label = lineEdit_6.text().strip(" ")
            # 拼接路径
            audio_path = "./audio/user_upload_audio/" + music_name + "_" + singer + "_" + music_label + file_format
            shutil.copy(file_path, audio_path)  # 拷贝音乐
            self.mt = MusicTool()
            self.mt.upload_song(music_name, audio_path, music_label, singer, music_duration)
            # 将歌曲加载到收藏中
            self.user_collections.append([music_name, file_path, singer, music_duration])
            self.mt = MusicTool()
            music_id, audio_path, singer, music_duration, music_label = self.mt.get_music_info(music_name)
            self.ut = UserTool()
            self.ut.insert_collections(self.current_user_id, music_id, 1)
        else:
            lineEdit_3.setText(" " + "需要输入音乐名⊙ω⊙")

    # 上一曲
    def previous_piece(self):
        # 上一首为空
        self.player = QMediaPlayer()
        if self.music_play_list:
            if self.play_index <= 0:
                # 播放原来
                self.play_index = 0
                self.player.setMedia(QMediaContent(QUrl.fromLocalFile(self.music_play_list[0][1])))
                self.horizontalSlider.setRange(0, self.music_play_list[0][3])
                # 歌名
                self.label_20.setText(self.music_play_list[0][0])
                # 歌手
                self.label_19.setText(self.music_play_list[0][2])
            else:
                self.play_index = self.play_index - 1
                # 播放上一首
                self.player.setMedia(QMediaContent(QUrl.fromLocalFile(self.music_play_list[self.play_index][1])))
                self.horizontalSlider.setRange(0, self.music_play_list[self.play_index][3])
                # 歌名
                self.label_20.setText(self.music_play_list[self.play_index][0])
                # 歌手
                self.label_19.setText(self.music_play_list[self.play_index][2])
            self.modify_like_pictures(self.music_play_list[self.play_index][0], self.pushButton_17)
            self.timer = QBasicTimer()
            self.play_time = 0
            self.horizontalSlider.setValue(0)
            self.player.setPosition(0)
            self.player.play()
            self.is_switching = False
            self.timer.start(1000, self)
            print("上一曲")

    # 下一首
    def next_song(self):
        self.player = QMediaPlayer()
        if self.music_play_list:
            if self.play_index >= len(self.music_play_list) - 1:
                self.play_index = len(self.music_play_list) - 1
                self.player.setMedia(
                    QMediaContent(QUrl.fromLocalFile(self.music_play_list[len(self.music_play_list) - 1][1])))
                self.horizontalSlider.setRange(0, self.music_play_list[len(self.music_play_list) - 1][3])
                # 歌名
                self.label_20.setText(self.music_play_list[len(self.music_play_list) - 1][0])
                # 歌手
                self.label_19.setText(self.music_play_list[len(self.music_play_list) - 1][2])
            else:
                self.play_index = self.play_index + 1
                # 播放上一首
                self.player.setMedia(QMediaContent(QUrl.fromLocalFile(self.music_play_list[self.play_index][1])))
                self.horizontalSlider.setRange(0, self.music_play_list[self.play_index][3])
                # 歌名
                self.label_20.setText(self.music_play_list[self.play_index][0])
                # 歌手
                self.label_19.setText(self.music_play_list[self.play_index][2])
            self.modify_like_pictures(self.music_play_list[self.play_index][0], self.pushButton_17)
            self.timer = QBasicTimer()
            self.play_time = 0
            self.horizontalSlider.setValue(0)
            self.player.setPosition(0)
            self.player.play()
            self.is_switching = False
            self.timer.start(1000, self)
            print("下一曲")

    # 音乐播放功能
    def music_play(self):
        if self.music_play_list:
            # 摄制音乐的上下时间限制
            if self.is_switching:
                print("播放")
                self.is_switching = False
                self.timer.start(1000, self)
                # 播放
                self.player.play()
            else:
                # 暂停
                self.player.pause()
                print("暂停")
                self.is_switching = True
                self.timer.stop()

    # 控制滑动
    def timerEvent(self, e):
        # 获取结束时间
        if self.music_play_list:
            end_time = self.music_play_list[self.play_index][3]
            # 当前时间是否播放结束
            if self.play_time == self.music_play_list[self.play_index][3]:
                self.timer.stop()
                self.play_time = 0
                self.horizontalSlider.setValue(0)
                self.player.stop()
            else:
                end_time -= self.play_time
                self.play_time += 1
                self.horizontalSlider.setValue(self.play_time)
                self.label_18.setText(itv2_time(end_time))

    # 拖拽进度条
    def drag_play(self):
        self.timer.stop()
        # 控制释放大小
        self.player.setPosition(round(self.horizontalSlider.value()*self.player.duration()/self.music_play_list[self.play_index][3]))

    # 拖拽进度条释放
    def drag_release(self):
        self.play_time = self.horizontalSlider.value()
        # 设置大小进度条大小
        self.horizontalSlider.setValue(self.play_time)
        self.timer.start(1000, self)


if __name__ == "__main__":
    app = QApplication(sys.argv)
    m = MainWindow("xiaowu", 12, "xiaowu")
    m.show()
    sys.exit(app.exec_())  # 程序关闭时退出进程
